<?php


namespace app\index\controller;



use app\common\controller\Basecontroller;
use app\index\model\Examine;
use think\Db;
use think\Request;

class Throwfiles extends Basecontroller
{
    /**
     * 用户投档页的获取用户投档的信息
     * ywh开发
     * @param Examine $examine
     * @param Request $request
     * @return \think\response\Json
     * @throws \think\exception\DbException
     */
    public function getUserState(Examine $examine , Request $request){
        $human = $this->getUserID();
        $state = $request->post('state') ?  $request->post('state') : [1,2,3,4,5];
        $currPage = $request->post('currPage');
        return $this->returnJson(self::OK, '返回用户投档信息', $examine->userThrow($human,$state,$currPage));
    }

    /**
     * 用户投档页，修改投档职位的信息
     * ywh开发
     * 接口是否开发完：否
     * @param Examine $examine
     * @param Request $request
     * @return \think\response\Json
     */
    public function upUserState(Examine $examine , Request $request){
        $human = $this->getUserID();
        $data = [
            'official_id'     =>    $request->post('offId'),
            'state'     =>    $request->post('state')
        ];
        if (!$examine->userState($human,$data)) return $this->returnJson(self::ERROR,'数据库错误');
        return $this->returnJson(self::OK,'修改成功');
    }

    /**
     * 获取热招职位信息的接口
     * ywh开发
     * 接口是否开发完：是
     * @param Examine $examine
     * @return \think\response\Json
     */
    public function getHotFiling(Examine $examine){
        return $this->returnJson(self::OK, '返回热招职位信息', $examine->hot());
    }
}

